home *** CD-ROM | disk | FTP | other *** search
Oberon Document | 1996-01-05 | 3.1 KB | 87 lines | [oODC/obnF] |
- Documents.StdDocumentDesc
- Documents.DocumentDesc
- Containers.ViewDesc
- Views.ViewDesc
- Stores.StoreDesc
- Documents.ModelDesc
- Containers.ModelDesc
- Models.ModelDesc
- Stores.ElemDesc
- TextViews.StdViewDesc
- TextViews.ViewDesc
- TextModels.StdModelDesc
- TextModels.ModelDesc
- TextModels.AttributesDesc
- Helvetica
- Helvetica
- Helvetica
- DevCommanders.StdViewDesc
- DevCommanders.ViewDesc
- MODULE ObxMacPICTView; (* od jul-93, ip nov-94 *)
- (* A sample Oberon/L program that shows how to open and display a Macintosh PICT file. *)
- (* In this demo app error checking is reduced to a minimum in favor of readability! *)
- IMPORT
- SYSTEM,
- QD := MacQuickDraw , FS := MacFileMgr, FN := MacFontMgr, MW := MacWindowMgr,
- MN := MacMenuMgr, TE := MacTextEdit, DL := MacDialogMgr, MT := MacTypes,
- EV := MacEventMgr, ME := MacMemoryMgr;
- PROCEDURE InitMac;
- BEGIN
- QD.InitGraf(QD.globals.thePort);
- (* The QuickDraw Globals are proper Oberon Variables *)
- FN.InitFonts;
- MW.InitWindows;
- MN.InitMenus;
- TE.TEInit;
- DL.InitDialogs(0);
- QD.InitCursor
- END InitMac;
- PROCEDURE OpenPict;
- VAR
- myTypes: FS.SFTypeList;
- myReply: FS.StandardFileReply;
- myRef: INTEGER;
- fsize: LONGINT;
- myPic: QD.PicHandle;
- err: INTEGER;
- myWindow: MW.WindowPtr;
- BEGIN
- myTypes[0] := 50494354H; (* PICT *)
- FS.StandardGetFile(NIL, 1, myTypes, myReply);
- IF myReply.sfGood THEN
- err := FS.FSpOpenDF(myReply.sfFile, 0, myRef);
- err := FS.GetEOF(myRef, fsize);
- err := FS.SetFPos(myRef, 1, 512);
- DEC(fsize, 512); (* strip PICT-header *)
- myPic := SYSTEM.VAL(QD.PicHandle, ME.NewHandle(fsize));
- IF myPic#NIL THEN
- err := FS.FSRead(myRef, fsize, SYSTEM.VAL(MT.Ptr, SYSTEM.ADR(myPic.picSize)));
- err := FS.FSClose(myRef);
- myWindow := MW.NewWindow(NIL, QD.globals.screenBits.bounds, '', TRUE, 1,
- SYSTEM.VAL(MW.WindowPtr, -1), FALSE, 0);
- QD.SetPort(myWindow);
- QD.OffsetRect(myPic.picFrame, -myPic.picFrame.left, -myPic.picFrame.top);
- QD.DrawPicture(myPic, myPic.picFrame);
- REPEAT UNTIL EV.Button();
- MW.DisposeWindow(myWindow)
- END
- END
- END OpenPict;
- BEGIN
- InitMac;
- OpenPict;
- END ObxMacPICTView.
- DevCompiler.Compile
- DevLinker.Link ":Obx:MacPICTView" +ObxMacPICTView >ObxMacPICTView
- TextControllers.StdCtrlDesc
- TextControllers.ControllerDesc
- Containers.ControllerDesc
- Controllers.ControllerDesc
- TextRulers.StdRulerDesc
- TextRulers.RulerDesc
- TextRulers.StdStyleDesc
- TextRulers.StyleDesc
- TextRulers.AttributesDesc
- Helvetica
- Documents.ControllerDesc
-